﻿using System;
using System.Collections.Generic;
using System.Text;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Application.Commands.Impl
{
    public class StoryCardUpdateCommand : ApCommandImpl
    {
        protected StoryCard before, after;

        public StoryCardUpdateCommand(AgilePlannerApplication app, StoryCard before, StoryCard after) : base(app)
        {
            this.before = before;
            this.after = after;
        }

        #region ApCommand Members

        public override void Undo()
        {
            if (!isUndone)
            {
                app.Persister.UpdateStoryCard(before);
                base.Undo();
            }
        }

        public override void Redo()
        {
            if (IsUndone)
            {
                app.Persister.UpdateStoryCard(after);
                base.Redo();
            }
        }

        #endregion
    }
}
